﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity;
using System.Data.EntityModel;
using System.Data.Objects;
using System.Data.Objects.DataClasses;
using System.Data.EntityClient;
using EF4.Model.Entities;
[assembly: EdmSchemaAttribute()]


namespace EF4.Repository.EF
{
    public class EF4Context : ObjectContext
    {
        public EF4Context()
            : base("name=EF4Container", "EF4Container")
        {
            Initilize();
            
        }

        private void Initilize()
        {
            products = CreateObjectSet<Product>();
            categories = CreateObjectSet<Category>();
            base.ContextOptions.LazyLoadingEnabled = true;
        }

        public EF4Context(EntityConnection connection)
            : base(connection, "EF4Container")
        {
            Initilize();            
        }

        private ObjectSet<Product> products;
        private ObjectSet<Category> categories;

        public ObjectSet<Category> Categories
        {get {return categories;}}

        public ObjectSet<Product> Products
        {get{return products;}}
        
    }
}
